import uiautomation,os,time

time.sleep(3)

# win=uiautomation.WindowControl(Name=u"计算器")#定义被测对象的窗口对象
# win.ButtonControl(AutomationId='82').Click()
# win.ButtonControl(Name="7").Click()
#
#
# win.ButtonControl(Name=u"加").Click()
#
# win.ButtonControl(Name="8").Click()
# win.ButtonControl(Name=u"等于").Click()
# res=win.TextControl(AutomationId='158').Name
# print(res)
# if res=="15":
#     print("ok")
# else:
#     print("ko")

wind=uiautomation.WindowControl(name="计算器")
wind.ButtonControl(Name="清除条目").Click()#点击CE

wind.ButtonControl(AutomationId="138").Click() #点击8
wind.ButtonControl(Name="乘").Click()
wind.ButtonControl(AutomationId="137").Click() #点击7
wind.ButtonControl(Name="等于").Click()
actual=wind.TextControl(AutomationId="158").Name
print(actual)

assert actual=="56"




